package com.mycat.core.controller;

import com.mycat.core.service.BookService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class BookController {

    @Autowired
    BookService bookService;

    @RequestMapping("queryAll.do")
    public String queryAll(Model model){
        model.addAttribute("books",bookService.queryAll());
        return "show";
    }
    @RequestMapping("queryOne.do")
    public String queryOne(Model model,@RequestParam int bid){
        model.addAttribute("book",bookService.queryById(bid));
        return "show";
    }
}
